export interface T_Camera_List_Item {
  /** 该相机的【编号】 */
  _id: string;

  /** 该相机的名称。 **/
  alias?: string;

  /** 该相机的 IP 地址。 **/
  addr?: string;

  rtsp?: string; // T_DeviceStreamUri_Rtsp;

  online?: boolean;

  /** 该相机的分组名称。 **/
  parent?: string;

  isWarning?: boolean;
  /** 是否有警告 */
}

export interface T_WarnMsg_List_Item {
  content: string;
  msgType: number;
  everydayNum: number;
}

export interface T_SocketPipelineData {
  camera_id: string;
  model: string;
  pipeline_id: string;
  Warning?: boolean;
  action?: {
    class_name: string;
    class_id: number;
    confidence: number;
  };
  results: Array<{
    class_id?: string;
    class_name?: string;
    confidence: number;
    frame: {
      width: number;
      height: number;
    };
    bbox: {
      left: number;
      top: number;
      width: number;
      height: number;
    };
    color?: Array<string | number>;
    keypoints: Array<{
      keypoint_idx: number;
      x: number;
      y: number;
      keypoint_confidence: number;
    }>;
  }>;
}

export interface T_SocketPipelineResultData {
  camera_id: string;
  model: string;
  pipeline_id: string;
  pipeline: string;
  Warning?: boolean;
  results_resp: Array<{
    class_id?: string;
    class_name?: string;
    confidence: number;
    bbox: {
      left: number;
      top: number;
      width: number;
      height: number;
    };
    color?: Array<string | number>;
  }>;
}

export interface T_SocketPipelineWarnReason {
  camera_id: string;
  addr?: string;
  confirmed: boolean;
  reason: string;
  reason_code: number;
  model: string;
  pipeline_id: string;
  pipeline: string;
  Warning?: boolean;
  video: string;
  video_end: number;
  video_start: number;
  video_name?: string;
  _id: string;
}

export type T_DetectedDoSingle = {
  modbusId: string;
  doIndex: number;
  on: boolean;
  duration: number;
  autoReset?: boolean;
  alreadConfig?: boolean;
  enabled?: boolean;
  uiConfig?: {
    isShow: boolean;
  };
};
export interface DoConfig {
  heartBeatDo?: T_DetectedDoSingle[];
  startRecordDo?: T_DetectedDoSingle[];
  endRecordDo?: T_DetectedDoSingle[];
  safeDo?: T_DetectedDoSingle[];
  warnDo?: T_DetectedDoSingle[];
  detectedDo: T_DetectedDoSingle[];
  unDetectedDo: T_DetectedDoSingle[];
}
export interface T_RoiConfigItem_Api {
  cameraId: string;
  pipelineId: string;
  rois: Array<{
    positive: boolean; // roi区域是否取反 true 区域内 否则区域外
    points: Array<number[]>;
    detectionMod: string; // roi检测策略
    threshold: number; // roi阈值
    count: number; // roi 统计次数
    countPercent: number; // roi 统计次数准确率
    temperature: number;
  }>;
  detectionMode: number;
  threshold: number;
  count: number;
  countPercent: number;
  temperature: number;
  doConfig: DoConfig; // 全局roi 灯配置
  recordConfig?: {
    ahead_of_trigger: number;
    duration_after_trigger: number;
  };
}
